//
//  HRComposeButton.swift
//  microBlog
//
//  Created by HR_W on 16/5/28.
//  Copyright © 2016年 admin. All rights reserved.
//

import UIKit

private let imageHeight: CGFloat = 80

class HRComposeButton: UIButton {
    
    
    var composeItem: HRComposeItem? {
    
        didSet {
           setImage(UIImage(named: composeItem?.icon ?? ""), forState: .Normal)
            setTitle(composeItem?.title, forState: .Normal)
            titleLabel?.textAlignment = .Center
           titleLabel?.font = UIFont.systemFontOfSize(14)
           setTitleColor(UIColor.darkGrayColor(), forState: .Normal)
            
        }
    }

    override func titleRectForContentRect(contentRect: CGRect) -> CGRect {
        return CGRect(x: 0, y: imageHeight, width: imageHeight, height: contentRect.height - imageHeight)
    }
    
    override func imageRectForContentRect(contentRect: CGRect) -> CGRect {
        
        return CGRect(x: 0, y: 0, width: imageHeight, height: imageHeight)
    }
    
    
}
